package com.cyanite.playlv2api.parsers.json;

import com.cyanite.playlv2api.types.Stats;

import org.json.JSONException;
import org.json.JSONObject;

public class StatsParser extends AbstractParser<Stats> {

    @Override
    public Stats parse(JSONObject json) throws JSONException {
        Stats obj = new Stats();
        if (json.has("beenhere")) {
            obj.setBeenhere(new BeenhereParser().parse(json.getJSONObject("beenhere")));
        }
        if (json.has("checkins")) {
            obj.setCheckins(json.getString("checkins"));
        }
        if (json.has("herenow")) {
            obj.setHereNow(json.getString("herenow"));
        }

        return obj;
    }
}